package file;

import java.io.File;
import java.io.FileFilter;

/**
 *
 */
public class Test {
    public static void main(String[] args) {
        File dir=new File("./src/main/java/file");
        if (dir.isDirectory()){
            FileFilter filter=new FileFilter() {
                public boolean accept(File file) {
                    String name=file.getName();
                    return name.startsWith("D");
//                    Long len=file.length();  //返回字节大小小于900的
//                    return len<=900;
                }
            };
            File[] subs=dir.listFiles(filter);
            for (File sub:subs){
                System.out.println(sub.getName());
            }
        }
    }
}
